#pragma once
#include "ticket.hpp"
#include <pthread.h>
#include <iostream>
using namespace std;
class mutex
{
public:
    mutex(pthread_mutex_t& mtx)
        : mtx_(mtx)
    {
        pthread_mutex_lock(&mtx_);
        cout << "加锁成功" << endl;
    }
    ~mutex()
    {
        pthread_mutex_unlock(&mtx_);
        cout << "解锁成功" << endl;
    }

private:
    pthread_mutex_t mtx_;
};